//
//  ZFGoodtableViewCell.m
//  外星球生活圈
//
//  Created by MR.ZHOU on 15/8/15.
//  Copyright (c) 2015年 MR.ZHOU. All rights reserved.
//

#import "ZFGoodtableViewCell.h"
#import "ZFGoodCollectionViewCell.h"

@interface ZFGoodtableViewCell () <UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *ZFCollectionView;
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *ZFCollectionViewFlowLayout;

@end
 static NSString *ID = @"ZFGoodCollectionViewCell";
@implementation ZFGoodtableViewCell

- (void)awakeFromNib {
    
    
   
    _ZFCollectionView.scrollEnabled = NO;
    [_ZFCollectionView registerNib:[UINib nibWithNibName:@"ZFGoodCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:ID];
    _ZFCollectionViewFlowLayout.itemSize = CGSizeMake(_ZFCollectionView.bounds.size.width/2.0, _ZFCollectionView.bounds.size.height/2.0);
    _ZFCollectionViewFlowLayout.minimumInteritemSpacing = 0;
   
    _ZFCollectionViewFlowLayout.minimumLineSpacing = 0;
    
}
-(void)setList:(FamousList *)list{
    _list =list;
    
    [_ZFCollectionView reloadData];
    
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    return _list.list.count;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    ZFGoodCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
    cell.model = _list.list[indexPath.row];
    
    return cell;
}
@end
